﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SimpleRest.Serialization;
using SimpleRest.Serialization.Xsd;
using System.Xml.Linq;

namespace SimpleRest.Tests.Serialization
{
    [TestClass]
    public class XSDSerializerTests
    {
        [TestMethod]
        public void Pass_SerializeTestClassCollectionAndFormat()
        {
            XsdSerializer ser = new XsdSerializer();
            var xsd = ser.Serialize(typeof(TestClassCollection));
            var formattedXsd = XDocument.Parse(xsd, LoadOptions.PreserveWhitespace);
            Console.Write(formattedXsd);
        }
        [TestMethod]
        public void Pass_SerializeTestClassAndFormat()
        {
            XsdSerializer ser = new XsdSerializer();
            var xsd = ser.Serialize(typeof(TestClass));
            var formattedXsd = XDocument.Parse(xsd, LoadOptions.PreserveWhitespace);
            Console.Write(formattedXsd);
        }
    }

    public class TestClassCollection : MyCollection<TestClass>
    {

        public override List<TestClass> Items { get; set; }
    }

    public abstract class MyCollection<T>
    {
        public int Total { get; set; }
        public int Count { get; set; }

        public abstract List<T> Items { get; set; }

        public List<string> Stuff { get; set; }
    }

    public class TestClass
    {
        public string A { get; set; }
        public int C { get; set; }
        public string[] OtherStuff { get; set; }
    }
}
